<?php

@include_once('conn.php');

// 前端传一个uid
$id = $_GET['id'];

// $id = 3 ;

$obj = [];

if ($id) {
    $sql = "delete from cart_info where goodsid = $id ";
    mysqli_query($conn, $sql);
    // 受影响的行数
    $rows = mysqli_affected_rows($conn);
    if ($rows > 0) {
        $obj['status'] = true;
        $obj['msg'] = '删除成功';
    } else {
        $obj['status'] = false;
        $obj['msg'] = '删除失败,没有这条数据';
    }
} else {
    $obj['status'] = false;
    $obj['msg'] = '前端数据有误';
}

echo json_encode($obj);
